package file;

import java.io.File;

public class ListFileDemo {
    public static void main(String[] args) {

        File dir=new File(".");
        //判断是否是目录
        if (dir.isDirectory()){
            File[] files=dir.listFiles();
            System.out.println("子项个数"+files.length);
            for (File file:files){
                System.out.println(file.getName());
            }
        }
    }
}
